package day7;

public class Student2 {
    private String name;
    private int age;
    private String sex;
    private String major;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    public Student2(String name,int age){
        setName(name);
        setAge(age);
        setSex("男");
        setMajor("ACCP");
    }

    public Student2(String name,int age ,String sex,String major){
        setName(name);
        setAge(age);
        setSex(sex);
        setMajor(major);
    }

    public void show(){
        System.out.println("我的名字是"+getName());
        System.out.println("我的年龄是"+getAge());
        System.out.println("我的性别是"+getSex());
        System.out.println("我的专业是"+getMajor());
    }
}

class Student2Test{
    public static void main(String[] args) {
        System.out.println("构造方法1:");
        Student2 s1=new Student2("李华",18);
        s1.show();
        System.out.println(" ");
        System.out.println("构造方法2:");
        Student2 s2=new Student2("李明",18,"男","java");
        s2.show();
    }
}
